<template>
  <view class="page-main">
    <view class="body-main" v-show="page == 1">
      <view class="form-main">
        <view class="part1" style="padding: 0">
          <view class="title">基础信息</view>
          <!--		2倍高度 表单行 START		-->
          <view class="double-height-row" style="padding: 0px; height: 318rpx">
            <view class="row">
              <view class="row-name-left">盘源筛选</view>
              <view class="right-part"> </view>
            </view>
            <view class="row">
              <view class="right-part" style="width: 100%">
                <picker class="shared-picker input-wrapper" style="width: 90px !important" @change="changePro" :value="value"
                  :range="prolist" range-key="name">
                  <view class="uni-input" style="
                      overflow: hidden;
                      white-space: nowrap;
                      text-overflow: ellipsis;
                    ">{{ prolist[value] && prolist[value].name }}</view>
                  <view class="arrow-down-triangle"></view>
                </picker>
                <picker class="shared-picker input-wrapper" style="width: 90px !important; margin-left: 15px" @change="changeCity"
                  :value="value2" :range="citys" range-key="name">
                  <view class="uni-input" style="
                      overflow: hidden;
                      white-space: nowrap;
                      text-overflow: ellipsis;
                    ">{{ citys[value2] && citys[value2].name }}</view>
                  <view class="arrow-down-triangle"></view>
                </picker>
                <picker class="shared-picker input-wrapper" style="width: 90px !important; margin-left: 15px" @change="changeArea"
                  :value="value3" :range="areas" range-key="name">
                  <view class="uni-input" style="
                      overflow: hidden;
                      white-space: nowrap;
                      text-overflow: ellipsis;
                    ">{{ areas[value3] && areas[value3].name }}</view>
                  <view class="arrow-down-triangle"></view>
                </picker>
              </view>
            </view>
            <view class="row">
              <view class="row-name-left">所属盘源</view>
              <view class="right-part">
                <picker class="shared-picker input-wrapper" style="width: 100% !important" @change="changebuildlist"
                  :value="buildlistindex" :range="buildlist" range-key="title">
                  <view class="uni-input" style="width: 100% !important">{{
                    buildlist[buildlistindex]
                      ? buildlist[buildlistindex].title
                      : '暂无'
                  }}</view>
                  <view class="arrow-down-triangle test-here"></view>
                </picker>
              </view>
            </view>
          </view>
          <!--		2倍高度 表单行 END		-->

          <view class="row">
            <view class="row-name-left">房源标题</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入标题" v-model="title" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">座落</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入座落" v-model="zuoluo" />
              </view>
            </view>
          </view>

          <view class="row">
            <view class="row-name-left">房源类型</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changeType" :value="type" :range="house_sell_typelist"
                range-key="name">
                <view class="uni-input">{{
                  house_sell_typelist[type] && house_sell_typelist[type].name
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">楼层类型</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changeHouse_floor_typelist" :value="house_floor_typeIndex"
                :range="house_floor_typelist" range-key="name">
                <view class="uni-input">{{
                  house_floor_typelist[house_floor_typeIndex] &&
                  house_floor_typelist[house_floor_typeIndex].name
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">装修类型</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changeHouse_renovationlist" :value="house_renovationIndex"
                :range="house_renovationlist" range-key="name">
                <view class="uni-input">{{
                  house_renovationlist[house_renovationIndex] &&
                  house_renovationlist[house_renovationIndex].name
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">房型</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" pattern="[0-9]*" class="uni-input" placeholder="房型：单间0，一室1，两室2......"
                v-model="house_room" @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">厅数</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" pattern="[0-9]*" class="uni-input" placeholder="厅数：单间0，一厅1，两厅2......"
                v-model="house_hall" @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">面积</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" class="uni-input" placeholder="请输入面积" v-model="house_area"
                @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row" v-show="type != 0 && type != 3 && type != 7">
            <view class="row-name-left">售卖单价</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" class="uni-input" placeholder="请输入售卖单价/㎡"
                v-model="house_sell_price_m" @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row" v-show="type != 1 && type != 4 && type != 8">
            <view class="row-name-left">租金单价</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" class="uni-input" placeholder="请输入租金/㎡" v-model="house_price_m"
                @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row" v-show="type != 1 && type != 4 && type != 8">
            <view class="row-name-left">租赁方式</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入租赁方式" v-model="lease" />
            </view>
          </view>
          <view class="row" v-show="type != 1 && type != 4 && type != 8">
            <view class="row-name-left">付款方式</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入付款方式" v-model="payment" />
            </view>
          </view>

          <view class="row">
            <view class="row-name-left">所在楼层</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changebuild_floor" :value="build_floor" :range="build_floor_list"
                range-key="floor_number_name">
                <view class="uni-input" style="width: 100% !important">{{
                  build_floor_list[build_floor]
                    ? build_floor_list[build_floor].floor_number_name
                    : '暂无'
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">房号</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" v-show="
                  build_floor_list[build_floor] &&
                  build_floor_list[build_floor].floor_type == 3
                "
                :disabled="false" @change="changefloor" :value="floor" :range="floor_list" range-key="room_number">
                <view class="uni-input">{{
                  floor_list[floor] ? floor_list[floor].room_number : '暂无'
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
              <input placeholder-style="color: #9f69799" v-show="
                  build_floor_list[build_floor] &&
                  build_floor_list[build_floor].floor_type != 3
                "
                type="text" class="uni-input" placeholder="请输入房号" v-model="housenumber" />
            </view>
          </view>

          <view class="row">
            <view class="row-name-left">用途</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" class="uni-input" placeholder="请输入物业用途" v-model="house_purpose" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">朝向</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changehouse_direction" :value="house_directionIndex"
                :range="house_direction" range-key="name">
                <view class="uni-input">{{
                  house_direction[house_directionIndex] &&
                  house_direction[house_directionIndex].name
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">委托信息(日期)</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" class="uni-input" placeholder="请输入委托信息(日期)" v-model="house_entrust" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">可容纳员工数</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" class="uni-input" type="number" placeholder="请输入可容纳员工数(数字)"
                v-model="employee_capacity" @blur="blur" @focus="focus" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">配套设施</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入配套设施" v-model="peitao" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">业主来源</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changeownertype" :value="ownertypeindex" :range="ownertype"
                range-key="name" style="width: 200rpx">
                <view class="uni-input">{{
                  ownertype[ownertypeindex] && ownertype[ownertypeindex].name
                }}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
              <view class="blue-wide-button" style="
                  height: 60rpx;
                  width: 200rpx;
                  font-size: 24rpx;
                  margin-left: 20rpx;
                "
                @tap="addOwner">
                新增联系方式
              </view>
            </view>
          </view>
          <view class="" style="border: 2rpx solid #ccc; padding: 20rpx; margin-top: 20rpx" v-if="ownerlist.length != 0">
            <view class="ownercard" style="margin-top: 40rpx" v-for="(item, i) in ownerlist" :key="i">
              <view class="delowner" @tap="delowner(i)"></view>
              <text style="margin-left: 30rpx">业主{{ i + 1 }}</text>
              <view class="row">
                <view class="row-name-left">姓名</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入姓名(必填)"
                      v-model="item.owner_name" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">联系方式</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入手机号(必填)"
                      v-model="item.owner_phone" @blur="blur" @focus="focus" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">微信</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入微信"
                      v-model="item.wechat" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">微博</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入微博"
                      v-model="item.weibo" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">QQ</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入QQ"
                      v-model="item.qq" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">地域</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入地域"
                      v-model="item.regional" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">身份证</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入身份证"
                      v-model="item.id_number" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">邮箱</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入邮箱"
                      v-model="item.email" />
                  </view>
                </view>
              </view>
              <view class="row">
                <view class="row-name-left">地址</view>
                <view class="right-part">
                  <view class="uni-input-wrapper">
                    <input style="width: 400rpx" placeholder-style="color: #969799" class="uni-input" placeholder="请输入地址"
                      v-model="item.address" />
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
        <button class="blue-wide-button" style="margin-top: 10px" @tap="next">
          下一页
        </button>
      </view>
    </view>

    <!-- <view class="body-main" v-show="page==3">
      <view class="device-status_bar"></view>
      <view class="form-main">
        <view class="part1" style="padding: 0;">
          <view class="row">
            <view class="row-name-left">电梯个数</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" class="uni-input" placeholder="电梯个数 0:电梯,依次递增n个电梯"
                v-model="house_levator" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">房屋格局</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" class="uni-input" placeholder="请输入房屋格局" v-model="house_structure" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">家私</view>
            <view class="right-part">
              <picker class="shared-picker input-wrapper" @change="changehouse_furniture" :value="house_furnitureIndex"
                :range="house_furniture" range-key="name">
                <view class="uni-input">{{house_furniture[house_furnitureIndex] && house_furniture[house_furnitureIndex].name}}</view>
                <view class="arrow-down-triangle"></view>
              </picker>
            </view>
          </view>
          
          <view class="row">
            <view class="row-name-left">物业费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入物业费" v-model="property_costs" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">水费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入水费" v-model="water" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">电费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入电费" v-model="utility_fee" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">空调费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入空调费" v-model="air_conditioning_fee" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">卫生费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="number" class="uni-input" placeholder="请输入卫生费" v-model="health_expenses" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">停车费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入停车费" v-model="parking_fee" />
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">排污费</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" type="text" class="uni-input" placeholder="请输入停车费" v-model="discharge" />
            </view>
          </view>
          
          <view class="row">
            <view class="row-name-left">电梯品牌</view>
            <view class="right-part">
              <input placeholder-style="color: #9f69799" class="uni-input" placeholder="请输入电梯品牌" v-model="elevator_brand" />
            </view>
          </view>
          <button class="blue-wide-button" style="margin-top: 10px;" @tap="last">上一页</button>
          <button class="blue-wide-button" style="margin-top: 10px;" @tap="next">下一页</button>
        </view>
      </view>

    </view> -->
    <view class="body-main" v-show="page == 2">
      <view class="form-main">
        <view class="part2">
          <view class="title">图片信息</view>
          <view class="part2-desc" style="width: 700rpx;margin-top: 20rpx;font-weight: bold;">图片宽度范围在1100px-1300px，高度范围在800px-1000px，1100*800 ~1300*1000</view>
          <view class="part2-title" style="font-weight: normal; margin-top: 68rpx">房源缩略照片（1张）</view>

          <!--					上传图片-->
          <view class="upload-image">
            <view class="uni-uploader-body">
              <view class="u-demo-area">
                <u-toast ref="uToast"></u-toast>
                <view class="pre-box" v-if="!showUploadList">
                  <view class="pre-item" v-for="(item, index) in uploadedPhotoList" :key="index">
                    <image class="pre-item-image" :src="item.url" mode="aspectFill"></image>
                    <view class="u-delete-icon" @tap.stop="deleteItem(index)">
                      <u-icon name="close" size="20" color="#ffffff"></u-icon>
                    </view>
                    <u-line-progress v-if="item.progress > 0 && !item.error" :show-percent="false" height="16" class="u-progress"
                      :percent="item.progress"></u-line-progress>
                  </view>
                </view>
                <u-upload class="u-upload" width="164" height="164" ref="uUpload3" :custom-btn="customBtn"
                  :show-upload-list="showUploadList" :action="action" :auto-upload="autoUpload" :file-list="fileList"
                  :show-progress="showProgress" :deletable="deletable" :max-count="1" @on-list-change="house_thumblist">
                  <view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
                    <u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
                  </view>
                </u-upload>
              </view>
            </view>
          </view>
          <view class="part2-title" style="font-weight: normal; margin-top: 68rpx">房源轮播图照片（1-12张）</view>

          <!--					上传图片-->
          <view class="upload-image">
            <view class="uni-uploader-body">
              <view class="u-demo-area">
                <u-toast ref="uToast"></u-toast>
                <view class="pre-box" v-if="!showUploadList">
                  <view class="pre-item" v-for="(item, index) in uploadedPhotoList" :key="index">
                    <image class="pre-item-image" :src="item.url" mode="aspectFill"></image>
                    <view class="u-delete-icon" @tap.stop="deleteItem(index)">
                      <u-icon name="close" size="20" color="#ffffff"></u-icon>
                    </view>
                    <u-line-progress v-if="item.progress > 0 && !item.error" :show-percent="false" height="16" class="u-progress"
                      :percent="item.progress"></u-line-progress>
                  </view>
                </view>
                <u-upload class="u-upload" width="164" height="164" ref="uUpload2" :custom-btn="customBtn"
                  :show-upload-list="showUploadList" :action="action" :auto-upload="autoUpload" :file-list="fileList"
                  :show-progress="showProgress" :deletable="deletable" :max-count="12" @on-list-change="house_bannerlist">
                  <view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
                    <u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
                  </view>
                </u-upload>
              </view>
            </view>
          </view>
          <view class="part2-title" style="font-weight: normal; margin-top: 68rpx">房源结构设计图照片（1-12张）</view>

          <!--					上传图片-->
          <view class="upload-image">
            <view class="uni-uploader-body">
              <view class="u-demo-area">
                <u-toast ref="uToast"></u-toast>
                <view class="pre-box" v-if="!showUploadList">
                  <view class="pre-item" v-for="(item, index) in uploadedPhotoList" :key="index">
                    <image class="pre-item-image" :src="item.url" mode="aspectFill"></image>
                    <view class="u-delete-icon" @tap.stop="deleteItem(index)">
                      <u-icon name="close" size="20" color="#ffffff"></u-icon>
                    </view>
                    <u-line-progress v-if="item.progress > 0 && !item.error" :show-percent="false" height="16" class="u-progress"
                      :percent="item.progress"></u-line-progress>
                  </view>
                </view>
                <u-upload class="u-upload" width="164" height="164" ref="uUpload" :custom-btn="customBtn"
                  :show-upload-list="showUploadList" :action="action" :auto-upload="autoUpload" :file-list="fileList"
                  :show-progress="showProgress" :deletable="deletable" :max-count="12" @on-list-change="design_imglist">
                  <view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
                    <u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
                  </view>
                </u-upload>
              </view>
            </view>
          </view>
          <button class="blue-wide-button" style="margin-top: 10px" @tap="last">
            上一页
          </button>
          <button class="blue-wide-button" style="margin-top: 10px" @tap="next">
            下一页
          </button>
        </view>
      </view>
    </view>
    <view class="body-main" v-show="page == 3">
      <view class="form-main">
        <view class="part2">
          <view class="title" style="margin-bottom: 40rpx">推荐理由</view>
          <view class="part2-title"><text style="font-size: 12px; color: #969799; font-weight: none">(提炼2-3个点，输入字数不要超过140字)</text></view>
          <view class="part2-desc" style="width: 300px">房源标签用逗号进行分割(中文字数为5个以内的4个标签)</view>
          <view class="row">
            <view class="row-name-left">1、房源标签：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_label" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">2、房源亮点：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_point" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">3、大厦介绍：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_building" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">4、交通配套：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_traffic" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">5、物业介绍：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_property" />
              </view>
            </view>
          </view>
          <view class="row">
            <view class="row-name-left">6、周边配套： </view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_around" />
              </view>
            </view>
          </view>
          <view class="row" style="border-bottom: none">
            <view class="row-name-left">7、布局装修：</view>
            <view class="right-part">
              <view class="uni-input-wrapper">
                <input placeholder-style="color: #969799" class="uni-input" placeholder="请输入内容" v-model="sell_layout" />
              </view>
            </view>
          </view>
          <button class="blue-wide-button" style="margin-top: 10px" @tap="last">
            上一页
          </button>
          <button class="blue-wide-button" style="margin-top: 10px" @tap="next">
            下一页
          </button>
        </view>
      </view>
    </view>
    <view class="body-main" v-show="page == 4">
      <view class="form-main">
        <view class="part2">
          <view class="title">备注描述</view>
        </view>
        <textarea placeholder-style="color: #9f69799;" style="
            width: 582rpx;
            margin-top: 20rpx;
            padding: 20rpx;
            border: 2rpx solid #eaeaea;
          "
          placeholder="请输入备注" v-model="remark" />
        <button class="blue-wide-button" style="margin-top: 10px" @tap="last">
          上一页
        </button>
        <button
          class="blue-wide-button"
          style="margin-top: 10px"
          @tap="addHouse(0)"
        >
          保存
        </button>
        <button
          class="blue-wide-button"
          style="margin-top: 10px"
          @tap="addHouse(1)"
          v-show="house_sell_typelist[type].value==1||house_sell_typelist[type].value==2||house_sell_typelist[type].value==3"
        >
          提交
        </button>
      </view>
    </view>
  </view>
</template>

<script>
import { mapGetters } from 'vuex';

import { TESTING } from '@/util/test';
import { MY_LOCATION, TOAST_DURATION } from '@/util/misc';
import {
  passFormCheck,
  phone_verify_rule,
  uniNavigate,
  uniShowToast,
} from '../util/misc';
import { uniHideLoading, uniShowLoading } from '../util/commonFuncs';
import { getTime } from '../util/rongCloud/messaging';

export default {
  data() {
    return {
      submitType: 0,
      ownerlist: [],
      housenumber: '',
      payment: '', //付款方式,
      peitao: '', //配套信息,
      lease: '', //租赁方式,
      zuoluo: '', //坐落,
      // water:'',//水费,
      location: uni.getStorageSync(MY_LOCATION),
      // page1
      maxCount: 15,
      List: [],
      uploadedPhotoList: [],
      title: TESTING ? 'fyTitle' + getTime() : '',
      type: 0,
      house_purpose: TESTING ? 'xie zi ' : '',
      sell_label: TESTING ? 'xie zi ' : '',
      sell_point: TESTING ? 'xie zi ' : '',
      sell_building: TESTING ? 'xie zi ' : '',
      sell_traffic: TESTING ? 'xie zi ' : '',
      sell_property: TESTING ? 'xie zi ' : '',
      sell_around: TESTING ? 'xie zi ' : '',
      sell_layout: TESTING ? 'xie zi ' : '',
      //房源省略图
      house_thumb: [],
      //房源轮播图
      house_banner: [],
      //房源细节图
      design_img: [],

      //page2
      page: TESTING ? 1 : 1,
      house_room: TESTING ? 'xie zi ' : '',
      house_hall: TESTING ? 'xie zi ' : '',
      house_price_m: TESTING ? 'xie zi ' : '',
      house_area: TESTING ? 'xie zi ' : '',
      house_floor: TESTING ? 'xie zi ' : '',
      house_number: TESTING ? 'xie zi ' : '',
      //house_birth: TESTING ? 'xie zi ' : '',
      // house_levator: TESTING ? 'xie zi ' : '',
      // house_structure: TESTING ? 'xie zi ' : '',
      house_entrust: TESTING ? 'xie zi ' : '',
      property_costs: TESTING ? 'xie zi ' : '',
      // utility_fee: TESTING ? 'xie zi ' : '',
      // air_conditioning_fee: TESTING ? 'xie zi ' : '',
      // health_expenses: TESTING ? 'xie zi ' : '',
      // parking_fee: TESTING ? 'xie zi ' : '',
      employee_capacity: TESTING ? 'xie zi ' : '',
      //discharge: TESTING ? 'xie zi ' : '',
      // elevator_brand: TESTING ? 'xie zi ' : '',
      remark: TESTING ? 'xie zi ' : '',
      house_sell_price_m: TESTING ? 'xie zi ' : '',

      ownertype: [
        {
          value: 1,
          name: '上门放盘',
        },
        {
          value: 2,
          name: '接收委托',
        },
        {
          value: 3,
          name: '平台进线',
        },
      ],
      ownertypeindex: 0,
      buildlistindex: 0,
      value: 0,
      value2: 0,
      value3: 0,
      // 图片上传相关 end:
      index: 0,
      sourceTypeIndex: 2,
      sourceType: ['拍照', '相册', '拍照或相册'],
      sizeTypeIndex: 2,
      sizeType: ['压缩', '原图', '压缩或原图'],
      countIndex: 8,
      count: [1, 2, 3, 4, 5, 6, 7, 8, 9],
      buildlist: [],
      // uView 图片上传 data ,START
      action: 'http://www.tp5.com',
      // 预置上传列表
      fileList: [],
      // fileList: [{
      // 	url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg',
      // 	error: false,
      // 	progress: 100
      // }],

      showUploadList: true,
      customBtn: false, // 个性化上传按钮?
      autoUpload: false,
      showProgress: true,
      deletable: true,
      customStyle: false,
      build_floor_list: [],
      build_floor: 0,
      floor: 0,
      house_sell_typelist: [
        {
          value: 1,
          name: '租',
        },
        {
          value: 2,
          name: '售',
        },
        {
          value: 3,
          name: '租售',
        },
        {
          value: 4,
          name: '已租',
        },
        {
          value: 5,
          name: '已售',
        },
        {
          value: 6,
          name: '资料房',
        },
        {
          value: 7,
          name: '暂停房',
        },
        {
          value: 8,
          name: '司租',
        },
        {
          value: 9,
          name: '司售',
        },
      ],
      house_floor_typeIndex: 0,
      house_floor_typelist: [
        {
          value: 1,
          name: '低楼层',
        },
        {
          value: 2,
          name: '中楼层',
        },
        {
          value: 3,
          name: '高楼层',
        },
      ],
      house_renovationIndex: 0,
      house_renovationlist: [
        {
          value: 1,
          name: '毛坯',
        },
        {
          value: 1,
          name: '简修',
        },
        {
          value: 1,
          name: '精修',
        },
      ],
      // house_furnitureIndex: 0,
      // house_furniture: [{
      //   value: 0,
      //   name: '无'
      // }, {
      //   value: 1,
      //   name: '部分'
      // }, {
      //   value: 2,
      //   name: '全齐'
      // }],
      house_directionIndex: 0,
      house_direction: [
        {
          value: 1,
          name: '东',
        },
        {
          value: 2,
          name: '南',
        },
        {
          value: 3,
          name: '西',
        },
        {
          value: 4,
          name: '北',
        },
        {
          value: 5,
          name: '东南',
        },
        {
          value: 6,
          name: '东北',
        },
        {
          value: 7,
          name: '西南',
        },
        {
          value: 8,
          name: '西北',
        },
      ],
      imageList: [],
      requesting: false,
    };
  },
  watch: {
    buildlistindex: {
      handler() {
        uni.request({
          url: `${this.$http}/api/merchant/build_floor_list`,
          method: 'POST',
          header: {
            Authorization: 'Bearer ' + this.$store.state.token,
          },
          data: {
            build_id: this.buildlist[this.buildlistindex].id,
          },
          complete: (res) => {
            if (res.data.code == 200) {
              this.build_floor_list = [
                {
                  floor_number: '请选择楼层',
                  child: [
                    {
                      room_number: '请选择房号',
                    },
                  ],
                },
                ...res.data.data,
              ];
              // console.log('楼层列表: ', this.build_floor_list)
            }else if(res.data.code == 402 || res.data.code == 506){
                setTimeout(()=>{
                  this.$logout(res.data.msg);
                },1500)
              }
          },
        });
      },
    },
  },
  methods: {
    // 一个方法最好不要超过 100 行哦
    formSubmit(imgArr, formData) {
      uni.uploadFile({
        url: `${this.$http}/api/merchant/add_house`, //仅为示例，非真实的接口地址
        header: {
          Authorization: 'Bearer ' + this.$store.state.token,
        },
        // 需要提交的数据
        files: imgArr,
        formData: formData,
        complete: (res) => {
          // console.log('拓房上传', res.data)
          this.requesting = false;
          uniHideLoading();
          let obj = JSON.parse(res.data);
          if (obj.code === 200) {
            uni.pageScrollTo({
              scrollTop: 0,
              duration: 200,
            });
            this.$refs.uUpload.clear();
            this.$refs.uUpload2.clear();
            this.$refs.uUpload3.clear();
            Object.assign(this.$data, this.$options.data());
            uniShowToast(this.submitType ? '提交成功' : '保存成功', true, {
              complete: () => {
               
              },
            });
             uni.request({
               url: `${this.$http}/api/merchant/build_list`,
               method: 'POST',
               data: {
                 province: this.prolist[this.value].name,
                 city: this.citys[this.value2].name,
                 area: this.areas[this.value3].name,
               },
               header: {
                 Authorization: 'Bearer ' + this.$store.state.token,
               },
               success: (res) => {
                 // console.log(res.data)
                 if (res.data.code == 200) {
                   this.buildlist = res.data.data;
                   // console.log('build', this.buildlist)
                 }
               },
             });
          } else {
            uni.showToast({
              title: obj.msg,
              position: 'top',
              icon: 'none',
              duration: TOAST_DURATION,
            });
          }
        },
      });
    },
    // true: 通过, false: 失败
    formCheck() {
      let res =
        TESTING || // 测试条件下随便提交
        (this.sell_label &&
          this.sell_point &&
          this.sell_building &&
          this.sell_traffic &&
          this.sell_property &&
          this.sell_around &&
          this.sell_layout &&
          this.title &&
          this.buildlist[this.buildlistindex] &&
          this.house_thumb.length != 0 &&
          this.house_banner.length != 0 &&
          this.design_img.length != 0 &&
          this.peitao &&
          this.zuoluo &&
          this.house_room &&
          this.house_hall &&
          this.house_area &&
          this.house_entrust &&
          this.remark &&
          this.buildlist[this.buildlistindex] &&
          this.build_floor > 0 &&
          this.housenumber &&
          this.housenumber.toString() &&
          (this.house_sell_typelist[this.type].value == 3
            ? this.house_price_m && this.house_sell_price_m
            : this.house_price_m || this.house_sell_price_m) &&
          (this.house_sell_typelist[this.type].value == 2 ||
          this.house_sell_typelist[this.type].value == 5 ||
          this.house_sell_typelist[this.type].value == 9
            ? true
            : this.payment && this.peitao));

      // 员工数表单域校验
      console.log('lys');
      // res = res && (Math.floor(this.employee_capacity) === this.employee_capacity)
      // res = res && passFormCheck(
      //   {
      //     number: this.employee_capacity,
      //   },
      //   [
      //     {
      //       name: 'number',
      //       checkType: 'int',
      //       checkRule: '1,',
      //       errorMsg: '请正确输入员工数',
      //     },
      //   ]
      // );

      return res;
    },
    /**
     *
     * 标签验证
     */
    checkSell(){
      // let reg = new RegExp('^([\u4e00-\u9fa5]{1,5},){0,3}([\u4e00-\u9fa5]{1,5})$');
      this.sell_label = this.sell_label.replace(/，/g, ",")
      console.log('label',this.sell_label)
      // if(reg.test(this.sell_label)){
        return true
      // }else{
      //   uni.showToast({
      //     title: '请检查标签信息格式',
      //     position: 'top',
      //     icon: 'none',
      //     duration: TOAST_DURATION,
      //   });
      //   return false
      // }
    },
    /**
     *
     * @returns {boolean} true 为校验成功, false 为失败
     */
    checkOwnerInfo() {
      let res = true;
      if (TESTING) {
        this.addOwner();
        return res;
      }
      if (
        this.house_sell_typelist[this.type].value == 6 ||
        this.house_sell_typelist[this.type].value == 7
      ) {
      } else {
        if (this.ownerlist.length === 0) {
          uni.showToast({
            title: '请输入业主信息',
            position: 'top',
            icon: 'none',
            duration: TOAST_DURATION,
          });
          res = false;
          return res;
        }

        this.ownerlist.forEach((item) => {
          if (item.owner_name.toString().length > 0 && item.owner_phone) {
            res = true
          } else {
            uni.showToast({
              title: '请检查业主信息',
              position: 'top',
              icon: 'none',
              duration: TOAST_DURATION,
            });
            res = false;
          }
        });
      }
      return res;
    },
    integrateImages() {
      let imgs = [];
      imgs = [
        ...imgs,
        ...this.house_thumb.map((item, i) => {
          return {
            name: `house_thumb`,
            file: item.file,
            url: item.url,
            uri: item.url,
          };
        }),
      ];
      imgs = [
        ...imgs,
        ...this.house_banner.map((item, i) => {
          return {
            name: `house_banner[${i}]`,
            file: item.file,
            uri: item.url,
            url: item.url,
          };
        }),
      ];
      imgs = [
        ...imgs,
        ...this.design_img.map((item, i) => {
          return {
            name: `design_img[${i}]`,
            file: item.file,
            uri: item.url,
            url: item.url,
          };
        }),
      ];

      return imgs;
    },
    integrateFormData(type) {
      return {
        is_check: type,
        // water_fee:this.water,
        lease_way: this.lease,
        payment_method: this.payment,
        is_located: this.zuoluo,
        mating_set: this.peitao,
        house_sell_type: this.house_sell_typelist[this.type].value,
        house_purpose: this.house_purpose,
        build_id:
          this.buildlist[this.buildlistindex] &&
          this.buildlist[this.buildlistindex].id,
        title: this.title,
        sell_label: this.sell_label,
        sell_point: this.sell_point,
        sell_building: this.sell_building,
        sell_traffic: this.sell_traffic,
        sell_property: this.sell_property,
        sell_around: this.sell_around,
        sell_layout: this.sell_layout,
        'house_thumb[]': this.house_thumb,
        'house_banner[]': this.house_banner,
        design_img: this.design_img[0],
        house_room: this.house_room,
        house_hall: this.house_hall,
        house_price_m: this.house_price_m,
        house_area: this.house_area,
        house_price: this.house_price_m * this.house_area,
        house_floor:
          this.build_floor_list[this.build_floor] &&
          Number(this.build_floor_list[this.build_floor].floor_number),
        house_number: Number(this.housenumber),
        //house_birth: this.house_birth,
        house_floor_type: this.house_floor_typelist[this.house_floor_typeIndex]
          .value,
        house_renovation: this.house_renovationlist[this.house_renovationIndex]
          .value,
        // house_levator: this.house_levator,
        // house_structure: this.house_structure,
        // house_furniture: this.house_furniture[this.house_furnitureIndex].value,
        house_direction: this.house_direction[this.house_directionIndex].value,
        house_entrust: this.house_entrust,
        // property_costs: this.property_costs,
        // utility_fee: this.utility_fee,
        // air_conditioning_fee: this.air_conditioning_fee,
        // health_expenses: this.health_expenses,
        //parking_fee: this.parking_fee,
        employee_capacity: this.employee_capacity,
        // discharge: this.discharge,
        // elevator_brand: this.elevator_brand,
        remark: this.remark,
        house_sell_price_m: this.house_sell_price_m,
        house_sell_price: this.house_sell_price_m * this.house_area,
        owner_source: this.ownertype[this.ownertypeindex].value,
        owner_list: JSON.stringify(this.ownerlist),
      };
    },
    blur() {
      uni.hideToast();
    },
    focus() {
      // console.log(uni.getSystemInfoSync().platform == 'ios')
      if (uni.getSystemInfoSync().platform == 'ios') {
        uni.showToast({
          title: '请输入数字,若已符合格式请忽略',
          position: 'top',
          icon: 'none',
          duration: 5000,
        });
      }
    },
    delowner(i) {
      // console.log('i',i)
      this.ownerlist.splice(i, 1);
      // console.log(this.ownerlist)
    },
    addOwner() {
      let item = {
        owner_name: '',
        owner_phone: '',
        wechat: '',
        weibo: '',
        qq: '',
        regional: '',
        id_number: '',
        email: '',
        address: '',
      };
      if (TESTING) {
        item = {
          owner_name: 'jzy',
          owner_phone: '13011807250',
          wechat: 'wech',
          weibo: 't',
          qq: '1',
          regional: '',
          id_number: '',
          email: '',
          address: '',
        };
      }
      this.ownerlist.push(item);
    },
    getbuildfoollist() {
      uni.request({
        url: `${this.$http}/api/merchant/build_floor_list`,
        method: 'POST',
        header: {
          Authorization: 'Bearer ' + this.$store.state.token,
        },
        data: {
          build_id: this.buildlist[this.buildlistindex].id,
        },
        complete: (res) => {
          if (res.data.code == 200) {
            this.build_floor_list = [
              {
                floor_number: '请选择楼层',
                child: [
                  {
                    room_number: '请选择房号',
                  },
                ],
              },
              ...res.data.data,
            ];
            // console.log('楼层列表: ', this.build_floor_list)
          }else if(res.data.code == 402 || res.data.code == 506){
                setTimeout(()=>{
                  this.$logout(res.data.msg);
                },1500)
              }
        },
      });
    },
    changefloor(e) {
      if (this.floor_list[e.target.value].status != 1) {
        this.floor = e.target.value;
        this.housenumber = this.floor_list[this.floor].room_number;
      } else {
        uni.showToast({
          title: '当前房号禁选，重新选择',
          position: 'top',
          icon: 'none',
          duration: 2000,
        });
      }
    },
    changebuild_floor(e) {
      this.build_floor = e.target.value;
    },
    addHouse(type) {
      this.submitType = type;
      if (this.requesting) {
        uni.showToast({
          title: '请勿多次点击，正在上传中',
          position: 'top',
          icon: 'none',
          duration: TOAST_DURATION,
        });
        return;
      }
      this.requesting = true;
      console.log(1)
      if(!this.formCheck()){
        console.log(2)
        this.requesting = false;
        uni.showToast({
            title: '请检查输入信息是否完整或是否符合格式',
            position: 'top',
            icon: 'none',
            duration: TOAST_DURATION,
          });
        return
      }
      if(!this.checkOwnerInfo()){
        this.requesting = false;
        console.log(3)
        
        return
      }
      if(!(this.employee_capacity&&(this.employee_capacity % 1 === 0))){
        this.requesting = false;
        uni.showToast({
            title: '请输入正确的员工数',
            position: 'top',
            icon: 'none',
            duration: TOAST_DURATION,
          });
        return
      }
      console.log(this.checkSell())
      if(!this.checkSell()){
        this.requesting = false;
        return
      }
      uniShowLoading('上传中');
      // 表单校验, 业主信息校验
      // if ( && this.checkOwnerInfo()) {
        let imgArr = this.integrateImages();
        let formData = this.integrateFormData(this.submitType);
        // console.log('check: ', formData)
        // console.log('Bearer ' + this.$store.state.token)
        this.formSubmit(imgArr, formData);
      // } else {
      //   this.requesting = false;
      //   uni.showToast({
      //     title: '请检查输入信息是否完整或是否符合格式',
      //     position: 'top',
      //     icon: 'none',
      //     duration: TOAST_DURATION,
      //   });
      // }
      
    },
    changeownertype(e) {
      this.ownertypeindex = e.target.value;
    },
    changebuildlist(e) {
      this.buildlistindex = e.target.value;
    },
    changehouse_direction(e) {
      this.house_directionIndex = e.target.value;
    },
    // changehouse_furniture(e) {
    //   this.house_furnitureIndex = e.target.value
    // },
    changeHouse_renovationlist(e) {
      this.house_renovationIndex = e.target.value;
    },
    changeHouse_floor_typelist(e) {
      this.house_floor_typeIndex = e.target.value;
    },
    changePage(val) {
      // console.log('盘源', this.buildlist[this.buildlistindex].title)
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 200,
      });
      this.page = val;
    },
    last() {
      this.page--;
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 200,
      });
    },
    next() {
      this.page++;
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 200,
      });
      // if (this.sell_label && this.sell_point && this.sell_building && this.sell_traffic &&
      //   this.sell_property && this.sell_around && this.sell_layout && this.title && this.buildlist[this.buildlistindex] &&
      //   this.house_thumb.length != 0 && this.house_banner.length != 0 && this.design_img.length != 0 ||
      //   TESTING // 测试条件下允许下一页
      // ) {
      //   this.page = 2;
      //   uni.pageScrollTo({
      //     scrollTop: 0,
      //     duration: 200
      //   });
      // } else {
      //   uni.showToast({
      //     title: '请检查输入信息是否完整',
      //     position: 'top',
      //     icon: 'none',
      //     duration: TOAST_DURATION
      //   });
      // }
    },
    house_thumblist(list) {
      // let List = []
      // for (let i = 0; i < list.length; i++) {
      //   List.push(list[i].url)
      // }
      this.house_thumb = list;
      // console.log(this.house_thumb)
    },
    house_bannerlist(list) {
      // let List = []
      // for (let i = 0; i < list.length; i++) {
      //   List.push(list[i].url)
      // }
      this.house_banner = list;
      // console.log(this.house_banner)
    },
    design_imglist(list) {
      // let List = []
      // for (let i = 0; i < list.length; i++) {
      //   List.push(list[i].url)
      // }
      this.design_img = list;
      // console.log(this.design_img)
    },
    show() {
      // console.log(this.uploadedPhotoList)
    },
    changeType(e) {
      this.type = e.target.value;
      this.house_sell_price_m = '';
      this.house_price_m = '';
    },
    changePro(e) {
      this.value = e.target.value;
      this.value2 = 0;
      this.value3 = 0;
      this.buildlistindex = 0;
      this.location = {};
      this.getbuildlist();
    },
    changeCity(e) {
      this.value2 = e.target.value;
      this.value3 = 0;
      this.buildlistindex = 0;
      this.location = {};
      this.getbuildlist();
    },
    changeArea(e) {
      this.value3 = e.target.value;
      this.location = {};
      this.buildlistindex = 0;
      this.getbuildlist();
    },
    chooseImage: async function () {
      // #ifdef APP-PLUS
      // TODO 选择相机或相册时 需要弹出actionsheet，目前无法获得是相机还是相册，在失败回调中处理
      if (this.sourceTypeIndex !== 2) {
        let status = await this.checkPermission();
        if (status !== 1) {
          return;
        }
      }
      // #endif

      if (this.imageList.length === 9) {
        let isContinue = await this.isFullImg();
        // console.log("是否继续?", isContinue);
        if (!isContinue) {
          return;
        }
      }
      let _this = this;
      uni.chooseImage({
        sourceType: _this.sourceType[this.sourceTypeIndex],
        sizeType: _this.sizeType[this.sizeTypeIndex],
        count:
          this.imageList.length + this.count[this.countIndex] > 9
            ? 9 - this.imageList.length
            : this.count[this.countIndex],
        success: (res) => {
          this.imageList = this.imageList.concat(res.tempFilePaths);
        },
        fail: (err) => {
          // #ifdef APP-PLUS
          if (err['code'] && err.code !== 0 && this.sourceTypeIndex === 2) {
            this.checkPermission(err.code);
          }
          // #endif
          // #ifdef MP
          uni.getSetting({
            success: (res) => {
              let authStatus = false;
              switch (this.sourceTypeIndex) {
                case 0:
                  authStatus = res.authSetting['scope.camera'];
                  break;
                case 1:
                  authStatus = res.authSetting['scope.album'];
                  break;
                case 2:
                  authStatus =
                    res.authSetting['scope.album'] &&
                    res.authSetting['scope.camera'];
                  break;
                default:
                  break;
              }
              if (!authStatus) {
                uni.showModal({
                  title: '授权失败',
                  content:
                    'Hello uni-app需要从您的相机或相册获取图片，请在设置界面打开相关权限',
                  success: (res) => {
                    if (res.confirm) {
                      uni.openSetting();
                    }
                  },
                });
              }
            },
          });
          // #endif
        },
      });
    },
    isFullImg: function () {
      return new Promise((res) => {
        uni.showModal({
          content: '已经有9张图片了,是否清空现有图片？',
          success: (e) => {
            if (e.confirm) {
              this.imageList = [];
              res(true);
            } else {
              res(false);
            }
          },
          fail: () => {
            res(false);
          },
        });
      });
    },
    previewImage: function (e) {
      var current = e.target.dataset.src;
      uni.previewImage({
        current: current,
        urls: this.imageList,
      });
    },
    reUpload() {
      this.$refs.uUpload.reUpload();
    },
    clear() {
      this.$refs.uUpload.clear();
    },
    autoUploadChange(index) {
      this.autoUpload = index === 0;
    },
    controlChange(index) {
      if (index == 0) {
        this.showProgress = true;
        this.deletable = true;
      } else {
        this.showProgress = false;
        this.deletable = false;
      }
    },
    maxCountChange(index) {
      this.maxCount = index == 0 ? 1 : index == 1 ? 2 : 4;
    },
    customStyleChange(index) {
      if (index == 0) {
        this.showUploadList = false;
        this.customBtn = true;
      } else {
        this.showUploadList = true;
        this.customBtn = false;
      }
    },
    upload() {
      this.$refs.uUpload.upload();
    },
    deleteItem(index) {
      this.$refs.uUpload.remove(index);
    },
    getbuildlist() {
      let fromdata;
      if (this.areas[this.value3].name != '全部') {
        fromdata = {
          province: this.prolist[this.value].name,
          city: this.citys[this.value2].name,
          area: this.areas[this.value3].name,
        };
      } else {
        fromdata = {
          province: this.prolist[this.value].name,
          city: this.citys[this.value2].name,
        };
      }
      uni.request({
        url: `${this.$http}/api/merchant/build_list`,
        method: 'POST',
        header: {
          Authorization: 'Bearer ' + this.$store.state.token,
        },
        data: fromdata,
        success: (res) => {
          // console.log('build', res.data)
          if (res.data.code == 200) {
            this.buildlist = res.data.data;
            if (this.buildlist[this.buildlistindex]) {
              this.getbuildfoollist();
            }
          }else if(res.data.code == 402 || res.data.code == 506){
                setTimeout(()=>{
                  this.$logout(res.data.msg);
                },1500)
              }
        },
      });
    },
  },
  onLoad() {
    // if (TESTING){
    //   console.log(this.integrateFormData({type: 0,id:0}));
    // }

    if (this.location.city) {
      uni.request({
        url: `${this.$http}/api/merchant/build_list`,
        method: 'POST',
        header: {
          Authorization: 'Bearer ' + this.$store.state.token,
        },
        data: {
          province: this.prolist[this.value] && this.prolist[this.value].name,
          city: this.citys[this.value2] && this.citys[this.value2].name,
          area: this.areas[this.value3] && this.areas[this.value3].name,
        },
        success: (res) => {
          // console.log('build', res.data)
          if (res.data.code == 200) {
            this.buildlist = res.data.data;
          }
        },
      });
    } else {
      uniShowToast('请先选择您的定位', true);
      uniNavigate('/location/location');
    }
  },
  computed: {
    ...mapGetters([]),
    floor_list() {
      // console.log()
      if (
        this.build_floor_list[this.build_floor] &&
        this.build_floor_list[this.build_floor].child
      ) {
        // console.log('房号',[{
        //   room_number: '请选择房号'
        // }, ...this.build_floor_list[this.build_floor].child])
        return [
          {
            room_number: '请选择房号',
          },
          ...this.build_floor_list[this.build_floor].child,
        ];
      } else {
        return [];
      }
    },
    prolist() {
      // console.log('prolist', this.$store.state.prolist)
      return this.$store.state.prolist;
    },
    citys() {
      if (this.prolist.length != 0) {
        return this.prolist[this.value].children;
      } else {
        return [];
      }
    },
    areas() {
      if (this.prolist.length != 0) {
        return [
          {
            name: '全部',
          },
          ...this.citys[this.value2].children,
        ];
      } else {
        return [];
      }
    },
  },
};
</script>

<style scoped lang="scss">
@import '../assets/styles/global';
@import '../uview-ui/index.scss';
.ownercard {
  position: relative;
  .row {
    width: 79vw !important;
  }
}
.page-main {
  min-height: 100vh;
  background-color: $greyBackgroundColor;
  @include center;
  padding: 15px;
  overflow-x: hidden;

  .expand-housing-nav-bar {
    margin-bottom: 30rpx;
  }

  .body-main {
    .form-main {
      width: 686rpx;
      background-color: #ffffff;
      border-radius: 8rpx;
      padding: 15px;
      overflow: hidden;

      .part1,
      .part2 {
        @include borderBox;
        padding: 0;
        .title {
          text-align: center;
          font-size: 36rpx;
        }
        .row {
          width: 83vw;
          height: 52px;
          @include bottomGreyBorder;
          display: flex;
          justify-content: space-between;

          .row-name-left {
            height: 100%;
            align-items: center;
            display: flex;
            width: 190rpx;
            font-size: 28rpx;
          }

          .right-part {
            color: #bdc4ce;
            height: 100%;
            width: 450rpx;
            /*background-color: #D8D8D8;*/
            display: flex;
            align-items: center;

            .uni-input {
              width: 430rpx;
              height: 48rpx;
              font-size: 28rpx;
              color: #353535;
            }

            .input-wrapper {
              width: 100%;

              .uni-input {
                width: 90px;
                @include ellipsis;
                display: flex;
                align-items: center;
              }
            }
          }
        }

        .double-height-row {
          height: 212rpx;
          display: flex;
          flex-direction: column;
          width: 100%;

          .input-wrapper {
            width: 120rpx !important;
            margin-left: 90rpx;
            display: flex;
            align-items: center;

            &:first-child {
              margin-left: 0rpx;
            }
          }
        }
      }

      .part2 {
        margin-top: 48rpx;

        .part2-title {
          width: 100%;
          height: 48rpx;
          font-weight: bold;
          font-size: 28rpx;
          line-height: 48rpx;
          color: #3d444c;
          margin-bottom: 24rpx;
        }

        .part2-desc {
          width: 300rpx;
          height: 48rpx;
          font-size: 24rpx;
          line-height: 48rpx;
          letter-spacing: 0rpx;
          color: #969799;
        }

        .upload-image {
          .u-upload {
          }

          // deprecate
          .uni-uploader__input-box {
            width: 164rpx;
            height: 164rpx;
            background-color: #f7f8fa;
            border-radius: 8rpx;
            @include contain-no-repeat-center;
            background-image: url('@/static/images/expandHousing/tuanjiazhaopian_icon@3x.png');
          }
        }
      }
    }
  }
}
</style>

<style lang="scss">
@import '../assets/styles/global';
.delowner {
  width: 30rpx;
  height: 30rpx;
  @include contain-no-repeat-center;
  background-image: url('@/static/images/del.png');
  position: absolute;
  left: 110rpx;
  top: 2rpx;
}
// 内有arrow
.shared-picker {
  position: relative;

  .triangle-down-arrow,
  .arrow-down-triangle {
    width: 20rpx;
    height: 20rpx;
    @include contain-no-repeat-center;
    background-image: url('@/static/images/arrow.png');
    position: absolute;
    right: 0;
    top: 50%;
    margin-top: -10rpx;
  }

  .arrow-down-triangle {
    width: 12rpx;
    height: 12rpx;
    margin-top: -6rpx;
    background-image: url('@/static/images/record/triangle-arrow@3x.png');
  }
}
</style>
